package edu.gatech.oad.antlab.m7final;
import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.lang.reflect.Method;
public class Intro extends JFrame {
	JLabel display;
	IntroButtons three;
	 JButton loadButton, trailButton;
	 private JButton btnExitGame;
	 private ButtonListener listener;
	 public Intro(){
		super("oregon Trail");
		 display = new JLabel();

		 
		 	JPanel panel = new JPanel();
		 	

		ImageIcon icon = new ImageIcon("C:\\Users\\Akbar\\Desktop\\oregontrail.gif");
		Image img = icon.getImage();
		Image newimg = img.getScaledInstance(700, 400,  java.awt.Image.SCALE_SMOOTH);  
		Icon newIcon = new ImageIcon(newimg);  
		setLocation(350,160);
		
		//JPanel three = new JPanel();
		//three.add(btnNewButton);
		three = new IntroButtons();
		display.setIcon(newIcon);
		loadButton = three.getLoad();
		trailButton = three.getTrail();
		
		listener = new ButtonListener();
		btnExitGame = new JButton("Exit Game");
		btnExitGame.setVisible(false);
		panel.add(btnExitGame);
		panel.add(display);
		JPanel other = new JPanel();
		other.setLayout( new OverlayLayout(other));
		other.add(panel);
		other.add(three);
		btnExitGame.addActionListener(listener);
		
		getContentPane().add(other);

	    setSize(700,400);
	    setVisible(false);
	    setUndecorated(true);

	    repaint();
}
	public JButton getLoadButton(){
		return loadButton;
	}
	public JButton getTrailButton(){
		return trailButton;
	}


	    private class ButtonListener implements ActionListener{
	    	
	    	public void actionPerformed(ActionEvent e){
	    		if(e.getSource().equals(btnExitGame)){
	    			System.exit(0);
	    		}
	    	}


	    	
	    }

}
